package com.lancoo.ccas53.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lancoo.ccas53.entity.RuleTimeProhibit;
import com.lancoo.ccas53.entity.TeachingClassWeek;
import com.lancoo.ccas53.mapper.TeachingClassWeekMapper;
import com.lancoo.ccas53.service.TeachingClassWeekService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 教学班对应上课周数 服务实现类
 * </p>
 *
 * @author quin.song
 * @since 2024-05-20
 */
@Service
public class TeachingClassWeekServiceImpl extends ServiceImpl<TeachingClassWeekMapper, TeachingClassWeek> implements TeachingClassWeekService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void ruleSetSuit(Integer taskId, List<RuleTimeProhibit> list) {
        baseMapper.setAllNoRule(taskId);
        if (CollUtil.isNotEmpty(list)) {
            baseMapper.ruleSetSuit(list);
        }
    }
}
